/**
 * FileName: UserFeign
 * Author:   Administrator
 * Date:     2018/11/16 17:14
 * Description: 后台用户管理模块
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.fortune.rainshine.feign.system;

import com.fortune.rainshinecommon.entity.LoginRecordEntity;
import com.fortune.rainshinecommon.model.system.LoginRecord;
import com.fortune.rainshinecommon.model.system.User;
import com.fortune.rainshinecommon.query.UserIdQuery;
import com.fortune.rainshinecommon.query.UserQuery;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import com.fortune.rainshine.config.FeignConfig;
import com.fortune.rainshinecommon.base.MsgModel;
import com.fortune.rainshinecommon.model.SysUsers;
import com.fortune.rainshinecommon.model.system.YuYueModel;

import java.util.List;

/**
 * 〈一句话功能简述〉<br> 
 * 〈后台用户管理模块〉
 *
 * @author Administrator
 * @create 2018/11/16
 * @since 1.0.0
 */
@FeignClient(value = "rain-shine-system",configuration = FeignConfig.class)
@Controller
//@CrossOrigin(origins = "*", maxAge = 3600)
public interface  UserFeign {

    @PostMapping("/user/add")
    @ResponseBody
    MsgModel add(@RequestBody User user);

    @PostMapping("/user/list")
    @ResponseBody
    MsgModel list(@RequestBody SysUsers user);
    
    @PostMapping("/yuyue/add")
    @ResponseBody
    MsgModel add(@RequestBody YuYueModel user);
    
    @RequestMapping(value = "/yuyue/list")
    @ResponseBody
    MsgModel list(@RequestBody YuYueModel user);
    
    @PostMapping("/yuyue/update")
    @ResponseBody
    MsgModel update(@RequestBody YuYueModel user);

    @PostMapping("/user/getUserById")
    @ResponseBody
    User getUserById(@RequestBody Integer id);

    /**
     * 获取门店的在职店员
     * @param shopId
     * @return
     */
    @RequestMapping(value = "/user/getShopAssistantsByShopId")
    @ResponseBody
    List<User> getShopAssistantsByShopId(@RequestBody Integer shopId);

    @PostMapping("/user/getUsersByPhone")
    List<User> getUsersByPhone(@RequestBody String phone);

    /**
     * 获取门店的所有店员（包括离职）
     * @param shopId
     * @return
     */
    @RequestMapping(value = "/user/getAllAssistantsByShopId")
    List<User> getAllAssistantsByShopId(@RequestBody Integer shopId);

    @RequestMapping(value = "/user/getRoleIdByUserId")
    Integer getRoleIdByUserId(@RequestBody Integer userId);

    /**
     * 修改用户密码
     * @param query
     * @return
     */
    @RequestMapping(value = "/user/updatePsw")
    @ResponseBody
    MsgModel updatePsw(@RequestBody UserQuery query);

    /**
     * 修改用户头像
     * @param query
     * @return
     */
    @RequestMapping(value = "/user/updateAvatar")
    @ResponseBody
    MsgModel updateAvatar(@RequestBody UserQuery query);

    /**
     * 获取所有招商人员列表
     * @param query
     * @return
     */
    @RequestMapping(value = "/user/getAllMerchants")
    @ResponseBody
    MsgModel getAllMerchants(@RequestBody UserIdQuery query);

    @RequestMapping(value = "/user/addLoginRecord")
    void addLoginRecord(@RequestBody LoginRecordEntity loginRecordEntity);
}